home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / python2.4 / dummy_threading.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2005-10-18  |  1KB  |  66 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.4)
  3.  
  4. '''Faux ``threading`` version using ``dummy_thread`` instead of ``thread``.
  5.  
  6. The module ``_dummy_threading`` is added to ``sys.modules`` in order
  7. to not have ``threading`` considered imported.  Had ``threading`` been
  8. directly imported it would have made all subsequent imports succeed
  9. regardless of whether ``thread`` was available which is not desired.
  10.  
  11. :Author: Brett Cannon
  12. :Contact: brett@python.org
  13.  
  14. XXX: Try to get rid of ``_dummy_threading``.
  15.  
  16. '''
  17. from sys import modules as sys_modules
  18. import dummy_thread
  19. holding_thread = False
  20. holding_threading = False
  21. holding__threading_local = False
  22.  
  23. try:
  24.     if 'thread' in sys_modules:
  25.         held_thread = sys_modules['thread']
  26.         holding_thread = True
  27.     
  28.     sys_modules['thread'] = sys_modules['dummy_thread']
  29.     if 'threading' in sys_modules:
  30.         held_threading = sys_modules['threading']
  31.         holding_threading = True
  32.         del sys_modules['threading']
  33.     
  34.     if '_threading_local' in sys_modules:
  35.         held__threading_local = sys_modules['_threading_local']
  36.         holding__threading_local = True
  37.         del sys_modules['_threading_local']
  38.     
  39.     import threading
  40.     sys_modules['_dummy_threading'] = sys_modules['threading']
  41.     del sys_modules['threading']
  42.     sys_modules['_dummy__threading_local'] = sys_modules['_threading_local']
  43.     del sys_modules['_threading_local']
  44.     from _dummy_threading import *
  45.     from _dummy_threading import __all__
  46. finally:
  47.     if holding_threading:
  48.         sys_modules['threading'] = held_threading
  49.         del held_threading
  50.     
  51.     del holding_threading
  52.     if holding__threading_local:
  53.         sys_modules['_threading_local'] = held__threading_local
  54.         del held__threading_local
  55.     
  56.     del holding__threading_local
  57.     if holding_thread:
  58.         sys_modules['thread'] = held_thread
  59.         del held_thread
  60.     else:
  61.         del sys_modules['thread']
  62.     del holding_thread
  63.     del dummy_thread
  64.     del sys_modules
  65.  
  66.